@extends('layout.home.master')
@section('content')
    <div class="row mt-2">
        <div class="col-9">
            <div class="card card-body p-5">
                <form action="{{route('home.article.update',$article)}}" method="post">
                    @csrf @method('PUT')
                    <div class="form-group">
                        <label for="" >文章标题</label>
                        <input type="text" class="form-control" name="title" value="{{$article->title}}" >
                    </div>
                    <div class="form-group">
                        <label for="exampleFormControlTextarea1">文章内容</label>
                        <div id="editormd">
                            <textarea name="content" style="display:none;">{{$article->content}}</textarea>
                        </div>
                    </div>
                    <button type="submit" class="btn btn-info">添加文章</button>
                </form>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="card">
                <div class="card-header">
                    {{auth()->user()->name}}
                </div>
                <div class="card-body text-center">
                    <div class="avatar avatar-xl">
                        <img src="{{auth()->user()->icon}}" alt="" class="avatar-img rounded-circle">
                    </div>
                </div>
                {{--<div class="card-footer">--}}
                {{--<button class="btn btn-white btn-block"><span class="fe fe-plus "></span>关注</button>--}}
                {{--</div>--}}
            </div>
        </div>
    </div>
@endsection
@push('js')
    <script>
        require(['hdjs'], function (hdjs) {
            hdjs.editormd("editormd", {
                width: '100%',
                height: 300,
                toolbarIcons : function() {
                    return [
                        "bold", "del", "italic", "quote","|",
                        "list-ul", "list-ol", "hr", "|",
                        "link", "hdimage", "code-block", "|",
                        "watch", "preview", "fullscreen"
                    ]
                },
                //editor.md库位置
                path: "{{asset('org/hdjs')}}/package/editor.md/lib/"
            });
        });
    </script>
@endpush
